package com.rules.admin.utils;

import com.alibaba.fastjson.JSON;

import java.io.FileInputStream;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

public class TempletRegister {
   public static Map<String, Templet> templetMes = new HashMap();

   public void init() {
      FileInputStream in = null;

      try {
         in = new FileInputStream(URLDecoder.decode(this.getClass().getResource("/").getPath() + "/templet/JSONTemplet.json", "UTF-8"));
         String fileMes = TypeTransform.inputStream2String(in);
         List<Templet> templets = JSON.parseArray(fileMes, Templet.class);
         Iterator var4 = templets.iterator();

         while(var4.hasNext()) {
            Templet templet = (Templet)var4.next();
            templetMes.put(templet.getChName(), templet);
         }
      } catch (Exception var14) {
         var14.printStackTrace();
      } finally {
         if (in != null) {
            try {
               in.close();
            } catch (Exception var13) {
               var13.printStackTrace();
            }
         }

      }

   }
}
